import { BaseWindow } from "../../../../component/window/BaseWindow";
import { ILayer } from "../../../../mvc/interfaces/ILayer";
import { DataProvider } from "../../../../../fl/data/DataProvider";
import { Language } from "../../../../../extend/language/Language";
import { ObjCreate } from "../../common/ObjCreate";
import { TilePanel } from "../../equipment/TilePanel";
import { SuitAttrLockCellRenderer } from "./SuitAttrLockCellRenderer";
import { SuitAttrLockInfo } from "./SuitAttrLockInfo";
import { GButton } from "../../../../../com/mui/controls/GButton";
type int = number;
//class SuitAttrLockWindow
    
    export  class SuitAttrLockWindow extends BaseWindow
    {
        constructor(arg1: ILayer=null)
        {
            super(arg1);
            this._dataProvider = new DataProvider();
            this.setSize(393, 333);
            this.title = Language.getString(35956);
            this.titleHeight = 28;
            return;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            ObjCreate.createBg(17, 39, 178, 196, this);
            ObjCreate.createBg(198, 39, 178, 196, this);
            ObjCreate.createBg(17, 238, 357, 83, this);
            this._lockList = new TilePanel();
            this._lockList.columnWidth = 175;
            this._lockList.rowHeight = 185;
            this._lockList.horizontalGap = 5;
            this._lockList.setStyle("cellRenderer", SuitAttrLockCellRenderer);
            this._lockList.setSize(355, 185);
            this._lockList.move(20, 50);
            this.addChild(this._lockList);
            this._tipTxt = ObjCreate.createTextField("", 20, 245, 340, 90, this);
            this._tipTxt.wordWrap = true;
            this._tipTxt.mouseEnabled = false;
            this._tipTxt.htmlText = Language.getString(35961);
            return;
        }

        public updateBySuitCode(arg1: Array<any>, arg2: Array<any>): void
        {
            var loc1=0;
            var loc2=0;
            this._dataProvider.removeAll();
            if (arg1 && arg1.length > 0) 
            {
                loc1 = 0;
                while (loc1 < arg1.length) 
                {
                    if (arg1[loc1] > 0) 
                    {
                        this._dataProvider.addItem(new SuitAttrLockInfo(arg1[loc1] as int, true));
                    }
                    ++loc1;
                }
            }
            if (arg2 && arg2.length > 0) 
            {
                loc2 = 0;
                while (loc2 < arg2.length) 
                {
                    if (arg2[loc2] > 0) 
                    {
                        this._dataProvider.addItem(new SuitAttrLockInfo(arg2[loc2] as int, false));
                    }
                    ++loc2;
                }
            }
            if (this._dataProvider.length != 0) 
            {
                this._dataProvider.sortOn("suitCode");
            }
            else 
            {
                this._dataProvider.addItem(null);
                this._dataProvider.addItem(null);
            }
            this._lockList.dataProvider = this._dataProvider;
            return;
        }

        /* internal */ /* var */_lockList: TilePanel;

        /* internal */ /* var */_lockTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_ableLockTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_tipTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_unlockBtn: GButton;

        /* internal */ /* var */_lockBtn: GButton;

        /* internal */ /* var */_dataProvider: DataProvider;
    }
